<template>

  <Form ref="form" :model="formData" :rules="ruleValidate" :label-width="80">
    <input type="hidden" v-model="formData.id"/>


        <FormItem label="名称" prop="name">
          <Input v-model="formData.name"></Input>
        </FormItem>
        <FormItem label="电话" prop="phone">
          <Input v-model="formData.phone"></Input>
        </FormItem>

    <FormItem label="类型" prop="type">
      <select v-model="formData.type"  placeholder="请选择">

        <option value="成人">成人</option>
        <option value="学生">学生</option>
      </select>
    </FormItem>

        <FormItem label="身份证号" prop="idCard">
          <input v-model="formData.idCard"></input>
        </FormItem>


    <FormItem label="地址" prop="address">
      <Input v-model="formData.address"></Input>
    </FormItem>

    <FormItem>
      <Button type="primary" @click="handleSubmit('form')">保存</Button>
      <Button type="primary" @click="go2list()" style="margin-left: 8px">关闭</Button>
    </FormItem>

  </Form>

</template>

<script>

import {baseEdit} from '@/libs/crud/base-edit'
import {validateTel} from "@/libs/validate/base-rule";

export default {
  mixins: [baseEdit],
  data () {
    return {
      formData: {
        id: '',
        name: '',
        idCard: '',
        phone: '',
        type: '',
        address: ''
      },
      ruleValidate: {
        name: [
          {required: true, message: '名称不能为空', trigger: 'blur'}
        ],
        phone: [
          {required: true, message: '电话不能为空', trigger: 'blur'},
          // { validator: validateTel, trigger: 'blur' }
        ]
      }
    }
  }
}
</script>
